package com.yiya.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.yiya.bean.Employee;
import com.yiya.mapper.EmployeeMapper;
import com.yiya.model.EmployeeReceiveModel;

@Service("employeeService")
public class EmployeeService {
	@Autowired
	private EmployeeMapper employeeMapper;
	
	public int add(Employee bean){
		return employeeMapper.insert(bean);
	}
	
	public int update(Employee bean){
		return employeeMapper.updateByPrimaryKeySelective(bean);
	}
	
	public Employee queryById(Integer id){
		return employeeMapper.selectByPrimaryKey(id);
	}
	
	public int updaeBySelective(Employee bean){
		return employeeMapper.updateByPrimaryKeySelective(bean);
	}

	public Employee queryByUserId(Integer id){
		return employeeMapper.selectByUserId(id);
	}
	
	public int getEmployeeCountByUserId(Integer id){
		return employeeMapper.getEmployeeCountByUserId(id);
	}
	
	public List<Employee> selectAllBySerCompanyId(EmployeeReceiveModel model){
		return employeeMapper.selectAllBySerCompanyId(model);
	}
}
